Skip to content

Replaced field_masking_span occurrences with respective ParseField #74718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 9, 2021

Conversation

GrayFox1
Copy link
Contributor

Closes #63527.

Replaced field_masking_span occurrences with respective ParseField. This change improves maintainability, since some hard coded Strings were replaced by the ParseField that i've defined in the FieldMaskingSpanQueryBuilder Class, besides being consistent with other span queries.

I've ran the tests with "gradlew :server:test --tests org.elasticsearch.index.*" and i would appreciate if someone could give me some feedback.

@elasticsearchmachine elasticsearchmachine added v8.0.0 external-contributor Pull request authored by a developer outside the Elasticsearch team labels Jun 29, 2021
@mark-vieira
Copy link
Contributor

@elasticmachine retest this please

1 similar comment
@mark-vieira
Copy link
Contributor

@elasticmachine retest this please

@mark-vieira
Copy link
Contributor

@elasticmachine test this pleasee

Copy link
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this pull request @GrayFox1! I left a couple of comments but this looks pretty close to me.

@@ -110,7 +110,7 @@ public static FieldMaskingSpanQueryBuilder fromXContent(XContentParser parser) t
throw new ParsingException(parser.getTokenLocation(), "[field_masking_span] query must be of type span query");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we replace the name in these error messages as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, i'll fix those messages in my next commit

@@ -73,13 +74,13 @@ public void testFromJson() throws IOException {
"}";
Exception exception = expectThrows(ParsingException.class, () -> parseQuery(json));
assertThat(exception.getMessage(),
equalTo("field_masking_span [query] as a nested span clause can't have non-default boost value [0.23]"));
equalTo(NAME.getPreferredName() + " [query] as a nested span clause can't have non-default boost value [0.23]"));
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add a test that uses the old deprecated name, and checks for a deprecation warning? There's an assertWarnings() helper method that will check for specific deprecation strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, i'll add a new test in my next commit.

@romseygeek
Copy link
Contributor

@elasticmachine test this please

@romseygeek
Copy link
Contributor

There's a failure in SearchModuleTests which I think can be resolved by adding span_field_masking to a list of expected queries and field_masking_span to a list of expected deprecated queries.

@GrayFox1
Copy link
Contributor Author

Thanks for your feedback @romseygeek! I just updated my pull request according to your comments and ran all tests with gradlew :server:test --tests org.elasticsearch.index.*

Copy link
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @GrayFox1, this looks great. Two more nits and then I think we're done, as long as CI is happy.

@@ -11,4 +11,4 @@
</ProjectSpecificProfile>
</option>
</component>
</project>
</project>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can you revert this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, i guess this happened when i was trying to configure the eclipseCodeFormatter plugin, but i'll revert this in my next commit.

@@ -303,7 +304,7 @@ public void testRegisterRescorer() {
"combined_fields",
"dis_max",
"exists",
"field_masking_span",
NAME.getPreferredName(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just use "span_field_masking" here to keep in line with the other entries in the list.

@romseygeek
Copy link
Contributor

@elasticmachine test this please

@romseygeek
Copy link
Contributor

@GrayFox1 you'll need to merge in the latest version of our master branch to get tests to pass (we've had a version bump internally so all the BWC checks are complaining).

@jtibshirani jtibshirani added the :Search/Search Search-related issues that do not fall into other categories label Jul 1, 2021
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Jul 1, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@GrayFox1
Copy link
Contributor Author

GrayFox1 commented Jul 1, 2021

Thanks @romseygeek! I just updated my pull request according to your comments, ran the tests with gradlew :server:test --tests org.elasticsearch.index* and all of them passed.

There is only one test failing when i ran gradlew :server:test --tests org.elasticsearch.search* in the SearchModuleTests. The failure is on the testRegisteredQueries when it iterates on the expected queries list and can't find "span_field_masking", although i have added this query in the list.

I tried looking into the SearchModule to check if the QuerySpec Registration wasn't using the ParseField, but everything looks ok.

@GrayFox1 GrayFox1 requested a review from romseygeek July 2, 2021 13:32
@romseygeek
Copy link
Contributor

@elasticmachine test this please

@romseygeek
Copy link
Contributor

Aha, this looks like it's a bug in the test - it's filtering out queries that have any deprecated names, not queries that have been entirely deprecated. I'll open a separate fix for that.

@romseygeek
Copy link
Contributor

I opened #74906 to fix the search test issue - you can merge that in here first as well if you like so that we can see how happy CI is otherwise.

@romseygeek
Copy link
Contributor

@elasticmachine update branch

@romseygeek
Copy link
Contributor

@elasticmachine ok to test

@romseygeek romseygeek added auto-backport Automatically create backport pull requests when merged auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) v7.15.0 labels Jul 9, 2021
@romseygeek romseygeek merged commit bb37e09 into elastic:master Jul 9, 2021
@romseygeek
Copy link
Contributor

Thanks @GrayFox1!

@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
7.x Commit could not be cherrypicked due to conflicts

To backport manually run:
backport --pr 74718

romseygeek pushed a commit that referenced this pull request Jul 9, 2021
`field_masking_span` is the only span query that does not begin with
`span_`.  This commit deprecates the existing name and adds a new
name `span_field_masking` to better fit with the other queries.
@romseygeek
Copy link
Contributor

Manually backported in fc5b80a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >enhancement external-contributor Pull request authored by a developer outside the Elasticsearch team :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v7.15.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Queries] make "Span field masking" consistent with other span queries
8 participants